Handle Response
Each RDA Admin web service response contains the following fields.
| Name | Description |
|---|---|
| RequestId | Unique identifier used to identify the request associated with the response. |
| Result | Value indicating type of result. Possible values: Error (default), Success, ValidationError, NoChange |
| ResultCode | Can be Error or Resource code depending on type of result |
| ResultMessage | Message regarding details of the Result. |
| ValidationResults | Array of ValidationResult objects containing messages regarding input validation. |
RequestId can be used to match a request and response. This is useful when requests are made asynchronously. Multiple requests can be outstanding and order of completion is not guaranteed.
Result will contain one of the enumerated values which can be used to determine how to handle the response.
ResultMessage may contain a message that provides additional information regarding the Result value. This is particularly useful for the Error result as it may contain an explanation of the error.
ValidationResults will contain and array of ValidationResult items when the Result is ValidationError. ValidationResult contains the following fields.
| Name | Description |
|---|---|
| Code | Value assigned by JHA for the validation result. |
| Message | Message explaining the validation result. |
Below is example code for response handling.
C# Example
private bool CheckSuccess(AuthenticatedResponse response)
{
return response != null && response.Result == ResponseResultType.Success;
}
private void HandleOther(AuthenticatedResponse response)
{
if (response.Result == ResponseResultType.Error)
{
Console.WriteLine(response.ResultCode + ":" + response.ResultMessage);
}
else if (response.Result == ResponseResultType.ValidationError)
{
foreach (var validation in response.ValidationResults)
{
Console.WriteLine(validation.Code + ":" + validation.Message);
}
}
}